import {
	post
} from 'utils/requests'

// 查看收藏的商品
export const getFarmerProductCollects = (type, pageNo, pageSize) => {
	return post({
		url: `/applet/mine/collection/getCollectionRecordsPageByType/${type}`,
		json:"json",
		data: {
			pageNo,
			pageSize
		},
		loading: true
	})
}

// 根据时间段查看收藏的商品
export const getProductCollectsOfDate = (pageNo,pageSize,type,startTime,endTime) => {
	return post({
		url: `/applet/mine/collection/getCollectionRecordsOfTheSpecifiedTimePeriod/${type}/${startTime}/${endTime}`,
		json:"json",
		data: {
			pageNo,
			pageSize
		}
	})
}

/* 取消收藏商品 */
export const cancelProductCollection = (id) => post({
	url: '/applet/mine/collection/cancelCollectionById',
	data: {
		productId:id
	}
})
// 查看浏览记录
export const getFarmerProductHistory = (type, pageNo, pageSize) => {
	return post({
		url: `/applet/mine/history/getBrowsingRecordPageByType/${type}`,
		json:"json",
		data: {
			pageNo,
			pageSize
		}
	})
}
// 查看浏览记录 选择时间范围
export const getBrowseRecordOfTheSpecifiedDate = (pageNo,pageSize,type,startTime,endTime) => {
	return post({
		// url: `/applet/mine/history/getBrowseRecordOfTheSpecifiedDate/${type}/${date}`,
		url: `/applet/mine/history/getBrowseRecordOfTheSpecifiedTimePeriod/${type}/${startTime}/${endTime}`,
		data: {
			pageNo,
			pageSize
		},
	})
}

// 删除浏览记录
export const delBrowsingRecordById = id => {
	return post({
		url: "/applet/mine/history/delBrowsingRecordById",
		data: {
			id
		},
		loading: true
	})
}